﻿@model IEnumerable<OAWeb.Models.StudentScore>
@Scripts.Render("~/bundles/jquery")
<script type="text/javascript">


</script>
@{
    ViewBag.Title = "成绩统计";
}
<h1>成绩统计</h1>
<table border="1" height="300" style="text-align:center">
    @{
    <tr>
        <td width="150" height="50">科目\班级</td>
        <td width="150" height="50"></td>

        @for (int i = 0; i < ViewBag.teachingClasses.Count; i++)
        {
            <td width="150" height="50">@ViewBag.teachingClasses[i][0].ClassName</td>
        }
        @*@for (int i = 0; i < ViewBag.tid.Count; i++)
        {
            <td width="150" height="50">@ViewBag.tid[i]</td>
        }*@
        <td width="150" height="50">全年级</td>

    </tr>

        int l = -1;
        for (int c = 0; c < ViewBag.cours.Length; c++)
        {

            <tr>
                <td>
                    @ViewBag.cours[c].Subject

                </td>
                <td colspan="@(ViewBag.teachingClasses.Count + 2)" style="border-right:hidden">
                    <table style="border-collapse:collapse;border-top:hidden;border-left:hidden;text-align:center;" border="1" height="150">
                        @{
                            int jishu = 0;

                            for (int k = 0; k < 4; k++)
                            {
                                double count = 0;

                                <tr>
                                    @if (k == 0)
                                    {
                                        <td width="150">平均分</td>
                                    }
                                    @if (k == 1)
                                    {
                                        <td width="150">及格率</td>
                                    }
                                    @if (k == 2)
                                    {
                                        <td width="150">优秀率</td>
                                    }
                                    @if (k == 3)
                                    {
                                        <td width="150">中位数</td>
                                    }

                                    @for (int i = 0; i < ViewBag.teachingClasses.Count; i++)
                                    {
                                        if (k == 0)
                                        {
                                            l++;
                                            <td width="150">
                                                @ViewBag.count[l]
                                            </td>
                                            count += ViewBag.count[l];
                                        }
                                        if (k == 3)
                                        {
                                            l++;
                                            <td width="150">
                                                @ViewBag.count[l]
                                            </td>
                                            count += ViewBag.count[l];
                                        }
                                        if (k == 1)
                                        {
                                            l++;
                                            <td width="150">
                                                @ViewBag.count[l]%
                                            </td>
                                            count += ViewBag.count[l];
                                        }
                                        if (k == 2)
                                        {
                                            l++;
                                            <td width="150">
                                                @ViewBag.count[l]%
                                            </td>
                                            count += ViewBag.count[l];
                                        }

                                    }

                                    @{
                                        if (k == 0)
                                        {
                                            <td width="150">@Math.Round(count / ViewBag.teachingClasses.Count, 2)</td>
                                        }
                                        if (k == 3)
                                        {
                                            <td width="150">@Math.Round(count / ViewBag.teachingClasses.Count, 2)</td>
                                        }
                                        if (k == 1)
                                        {
                                            <td width="150">@Math.Round(count / ViewBag.teachingClasses.Count, 2)%</td>
                                        }
                                        if (k == 2)
                                        {
                                            <td width="150">@Math.Round(count / ViewBag.teachingClasses.Count, 2)%</td>
                                        }
                                    }


                                </tr>
                                jishu += 10;
                            }

                        }

                    </table>
                </td>

            </tr>
        }







    }
</table>

@{


    @Html.ActionLink("查看统计图", "ScoreBar2", new { id = ViewBag.eid });
}